<?php 
	session_start();
	require('../Model/mysql.php');
	require('../host_config.php');
	if ($_SESSION['flag'] != 2) {
		echo "<script language='javascript'>";
		echo "alert('You have no permission to read this page!');";
		echo "history.back();";
		echo "</script>";
		header("location:../login.php");
	}
	$mysql = new MySQL();
	$link = $mysql->connect($mysql_host, $mysql_user,$mysql_passwd, $mysql_db);
	$output = $_SESSION["output"];
	$count = $mysql->real($_GET["count"]);
?>
<!DOCTYPE html>
<html>

<head>
<meta name="viewport" content="width=device-width; text/html; charset=utf-8" http-equiv="Content-Type">
<title>訂位資訊</title>
<link href="../mobile.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="banner">
	訂位資訊
	<div id="home">
		<a href="select.php">
		<img alt="" class="auto-style1" height="40" src="../pic/home.png" width="40"></a>
	</div>
	<div id="logout">
		<a href="../logout.php">
		<img alt="" class="auto-style1" height="41" src="../pic/logout.png" width="41"></a>
	</div>
</div>

<div id="content">
		<br/>
		<H1 align="center">符合查詢資料</H1>
                <form method="post" action="test.php?id=<?php echo $row[0];?>">
                <?php
                        //echo "<table border='1' align='center'><tr align='center'>";
                        //echo '<td>店家名稱</td>';
						//echo '<td>前往</td>';
                        //echo "</tr>";
                        /*
                        $sql = "SELECT all_name FROM name_temp";
                        $result = $mysql->query($sql, $link);
                        while ($row = mysql_fetch_row($result))
                        {
                        	$sql2 = "SELECT id FROM android WHERE all_name = '$row[0]'";
                        	$re = $mysql->query_row($sql2, $link);
                        	echo "<a href='test.php?id=".$re[0]."'>".$row[0]."</a><br>";
							//echo "<td>".$row[1]."</td>";
							//echo "<td><a href='test.php?id=".$re[0]."'>前往</a></td>";
                        }*/
                		$temp = 0;
                		while($temp < $count) {
							$sql = "SELECT fullname FROM Shops WHERE shopid = '$output[$temp]'";
							$row = $mysql->query_row($sql, $link);
							echo "<a href='../used/test.php?id=".$output[$temp]."'>".$row[0]."</a><br>";
                			$temp++;
                		}
						//echo "</table>";
                ?>
                </form>
<br /></div>
</body>

</html>